package com.book.manager.controller;

import com.book.manager.pojo.Supplier;
import com.book.manager.service.SupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author wzy
 * @Date 2024/6/2 0:14
 * @description: 供应商管理
 */
@RestController
public class SupplierController {
    @Autowired
    private SupplierService supplierService;

    @GetMapping("/api/supplier")
    public List<Supplier> list(){
        return supplierService.list();
    }
    @PostMapping("/api/Supplier")
    public boolean updateSupplier(@RequestBody Supplier supplier){
        return supplierService.addOrUpdate(supplier);
    }
    // 根据id删除供应商
    @DeleteMapping("/api/supplier/delete/{id}")
    public void deleteById(@PathVariable("id") int id){
        supplierService.deleteById(id);
    }
}
